//
//  MainMenuViewController.m
//
//  WoW Atlas, a World of Warcraft instance map, loot, and achievement browser.
//  Copyright 2010 Steven Mattera <stevenmattera@gmail.com>
//
//	Special Thanks to Dan Gilbert and the Atlas/Atlasloot Team.
//
//	WoW Atlas is free software; you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation; either version 2 of the License, or
//	(at your option) any later version.
//
//	WoW Atlas is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRENTY; without even the implied warrenty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more deails.
//
//	You should have received a copy of the GNU General Public License
//	along with WoW Atlas; if not, write to the Free Software
//	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//

#import "MainMenuViewController.h"
#import "WATableViewCell.h"

@implementation MainMenuViewController

- (id)init {
	if (self = [super init]) {
		_mainMenuTableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 416.0f) style:UITableViewStylePlain];
		[_mainMenuTableView setBackgroundColor:[UIColor colorWithWhite:0.078431373f alpha:1.0f]];
		[_mainMenuTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
		[_mainMenuTableView setDataSource:self];
		[_mainMenuTableView setDelegate:self];
		
		[self.view addSubview:_mainMenuTableView];
	}
	
	return self;
}

- (void)dealloc {
	[_mainMenuTableView setDelegate:nil];
	[_mainMenuTableView setDataSource:nil];
	[_mainMenuTableView release];
	_mainMenuTableView = nil;
	
    [super dealloc];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return 2;
}

- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
	if (section == 0) return 5;
	else if (section == 1) return 5;
	else if (section == 2) return 2;

	return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	WATableViewCell * cell = (WATableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MainMenu"];
	
	if (cell == nil) {
		cell = [[[WATableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MainMenu"] autorelease];
		[cell.textLabel setTextColor:[UIColor colorWithRed:1.0f green:0.81960784f blue:0.0f alpha:1.0f]];
	}
	
	if (indexPath.section == 0) {
		if (indexPath.row == 0) [cell.textLabel setText:LocStr(@"Dungeons")];
		else if (indexPath.row == 1) [cell.textLabel setText:LocStr(@"Raids")];
		else if (indexPath.row == 2) [cell.textLabel setText:LocStr(@"FlightPaths")];
		else if (indexPath.row == 3) [cell.textLabel setText:LocStr(@"OutdoorRaids")];
		else if (indexPath.row == 4) [cell.textLabel setText:LocStr(@"Battlegrounds")];
	}
	else if (indexPath.section == 1) {
		if (indexPath.row == 0) [cell.textLabel setText:LocStr(@"WorldEvents")];
		else if (indexPath.row == 1) [cell.textLabel setText:LocStr(@"Collections")];
		else if (indexPath.row == 2) [cell.textLabel setText:LocStr(@"Factions")];
		else if (indexPath.row == 3) [cell.textLabel setText:LocStr(@"PvPRewards")];
		else if (indexPath.row == 4) [cell.textLabel setText:LocStr(@"Crafting")];
	}
	else if (indexPath.section == 2) {
		if (indexPath.row == 0) [cell.textLabel setText:LocStr(@"TalentTrees")];
		else if (indexPath.row == 1) [cell.textLabel setText:LocStr(@"Achievements")];
	}

	return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	
}

@end
